package com.lanou.userLogin.book.web.servlet;

import com.lanou.userLogin.book.domain.Book;
import com.lanou.userLogin.book.service.BookService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/oneBookServlet")
public class OneBookServlet extends HttpServlet {

    private BookService bs = new BookService();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id = req.getParameter("id");
        req.getSession().setAttribute("bid",id);
        List<Book> oneBookLoadInfo = bs.oneBookLoad(id);
        req.setAttribute("oneBookLoadInfo",oneBookLoadInfo);
        req.getRequestDispatcher("/jsps/book/desc.jsp").forward(req,resp);
    }
}
